home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / obrn-a_1.5_lib.lha / oberon-a / source2.lha / source / amiga / SCSIDisk.mod < prev    next >
Encoding:
Text File  |  1995-01-26  |  5.4 KB  |  141 lines

  1. (**************************************************************************
  2.  
  3.      $RCSfile: SCSIDisk.mod $
  4.   Description: SCSI command definitions
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.7 $
  8.       $Author: fjc $
  9.         $Date: 1995/01/26 02:39:55 $
  10.  
  11.   $VER: scsidisk.h 36.2 (7.11.90)
  12.   Includes Release 40.15
  13.  
  14.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  15.       All Rights Reserved
  16.  
  17.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  18.   This file is part of the Oberon-A Interface.
  19.   See Oberon-A.doc for conditions of use and distribution.
  20.  
  21. ***************************************************************************)
  22.  
  23. <* STANDARD- *> <* INITIALISE- *> <* MAIN- *>
  24. <*$ CaseChk-  IndexChk- LongVars+ NilChk-  *>
  25. <*$ RangeChk- StackChk- TypeChk-  OvflChk- *>
  26.  
  27. MODULE [2] SCSIDisk;
  28.  
  29. IMPORT e := Exec, s := Sets;
  30.  
  31.  
  32. (*
  33. **
  34. **      SCSI exec-level device command
  35. **
  36. *)
  37.  
  38.  
  39. (* --------------------------------------------------------------------
  40.  *
  41.  *   SCSI Command
  42.  *      Several Amiga SCSI controller manufacturers are converging on
  43.  *      standard ways to talk to their controllers.  This include
  44.  *      file describes an exec-device command (e.g. for hddisk.device)
  45.  *      that can be used to issue SCSI commands
  46.  *
  47.  *   UNIT NUMBERS
  48.  *      Unit numbers to the OpenDevice call have encoded in them which
  49.  *      SCSI device is being referred to.  The three decimal digits of
  50.  *      the unit number refer to the SCSI Target ID (bus address) in
  51.  *      the 1's digit, the SCSI logical unit (LUN) in the 10's digit,
  52.  *      and the controller board in the 100's digit.
  53.  *
  54.  *      Examples:
  55.  *                0     drive at address 0
  56.  *               12     LUN 1 on multiple drive controller at address 2
  57.  *              104     second controller board, address 4
  58.  *               88     not valid: both logical units and addresses
  59.  *                      range from 0..7.
  60.  *
  61.  *   CAVEATS
  62.  *      Original 2090 code did not support this command.
  63.  *
  64.  *      Commodore 2090/2090A unit numbers are different.  The SCSI
  65.  *      logical unit is the 100's digit, and the SCSI Target ID
  66.  *      is a permuted 1's digit: Target ID 0..6 maps to unit 3..9
  67.  *      (7 is reserved for the controller).
  68.  *
  69.  *          Examples:
  70.  *                3     drive at address 0
  71.  *              109     drive at address 6, logical unit 1
  72.  *                1     not valid: this is not a SCSI unit.  Perhaps
  73.  *                      it's an ST506 unit.
  74.  *
  75.  *      Some controller boards generate a unique name (e.g. 2090A's
  76.  *      iddisk.device) for the second controller board, instead of
  77.  *      implementing the 100's digit.
  78.  *
  79.  *      There are optional restrictions on the alignment, bus
  80.  *      accessability, and size of the data for the data phase.
  81.  *      Be conservative to work with all manufacturer's controllers.
  82.  *
  83.  *------------------------------------------------------------------*)
  84.  
  85. CONST
  86.  
  87.   scsiCmd *      = 28;      (* issue a SCSI command to the unit *)
  88.                             (* ioData points to a SCSICmd *)
  89.                             (* ioLength is SIZE (SCSICmd) *)
  90.                             (* ioActual and ioOffset are not used *)
  91.  
  92. TYPE
  93.  
  94.   SCSICmdPtr * = POINTER TO SCSICmd;
  95.   SCSICmd * = RECORD
  96.     data *        : e.APTR;   (* word aligned data for SCSI Data Phase *)
  97.                               (* (optional) data need not be byte aligned *)
  98.                               (* (optional) data need not be bus accessable *)
  99.     length *      : e.ULONG;  (* even length of Data area *)
  100.                               (* (optional) data can have odd length *)
  101.                               (* (optional) data length can be > 2**24 *)
  102.     actual *      : e.ULONG;  (* actual Data used *)
  103.     command *     : e.APTR;   (* SCSI Command (same options as Data) *)
  104.     cmdLength *   : e.UWORD;  (* length of Command *)
  105.     cmdActual *   : e.UWORD;  (* actual Command used *)
  106.     flags *       : s.SET8;   (* includes intended data direction *)
  107.     status *      : SHORTINT; (* SCSI status of command *)
  108.     senseData *   : e.APTR;   (* sense data: filled if [OLD]AUTOSENSE *)
  109.                               (* is set and Status has CHECK CONDITION *)
  110.                               (* (bit 1) set *)
  111.     senseLength * : e.UWORD;  (* size of SenseData, also bytes to *)
  112.                               (* request w/ AUTOSENSE, must be 4..255 *)
  113.     senseActual * : e.UWORD;  (* amount actually fetched (0 means no sense) *)
  114.   END; (* SCSICmd *)
  115.  
  116. CONST
  117.  
  118. (* ----- scsiFlags -----*)
  119.   write *             = {};      (* intended data direction is out *)
  120.   read *              = 0;       (* intended data direction is in *)
  121.   readWrite *         = 0;       (* (the bit to test) *)
  122.   noSense *           = {};      (* no automatic request sense *)
  123.   autoSense *         = 1;       (* do standard extended request sense *)
  124.                                  (* on check condition *)
  125.   oldAutoSense *      = 2;       (* do 4 byte non-extended request *)
  126.                                  (* sense on check condition *)
  127.  
  128. (* ----- SCSI ioError values -----*)
  129.   selfUnit *          = 40;      (* cannot issue SCSI command to self *)
  130.   dma *               = 41;      (* DMA error *)
  131.   phase *             = 42;      (* illegal or unexpected SCSI phase *)
  132.   parity *            = 43;      (* SCSI parity error *)
  133.   selTimeout *        = 44;      (* Select timed out *)
  134.   badStatus *         = 45;      (* status and/or sense error *)
  135.  
  136. (* ----- OpenDevice ioError values -----*)
  137.   noBoard *           = 50;      (* Open failed for non-existant board *)
  138.  
  139.  
  140. END SCSIDisk.
  141.